#include "rule.h"
#include "grammar.h"
#include "parser.h"
#include "features.h"

unsigned int UniqId;

main ()
{
  class grammar G;
  UniqId=0;
  vector<string> v;
  v.push_back("np"); v.push_back("vp");
  G.addRule("s", v, new class features ("", "", ""));
  v.clear();
  v.push_back("pn");
  G.addRule("np", v, new class features ("", "", ""));
  v.clear();
  v.push_back("det"); v.push_back("n");
  G.addRule("np", v, new class features ("", "", ""));
  v.clear();
  v.push_back("np"); v.push_back("pp");
  G.addRule("np", v, new class features ("", "", ""));
  v.clear();
  v.push_back("v"); v.push_back("np");
  G.addRule("vp", v, new class features ("", "", ""));
  v.clear();
  v.push_back("v");
  G.addRule("vp", v, "$1");
  v.clear();
  v.push_back("vp"); v.push_back("pp");
  G.addRule("vp", v, "($2 $1)");
  v.clear();
  v.push_back("prep"); v.push_back("np");
  G.addRule("pp", v, "($1 $2)");

  G.setInitial("s");
  G.findTerms();
  
  list<pair <string, class features> > s;

  //Deuxieme champ sert à features
  s.push_back(pair <string, class features>("pn", features("sing","fem","trois"))); // Suzie
  s.push_back(pair <string, class features>("v", features("sing","","trois"))); // chases
  s.push_back(pair <string, class features>("pn", features("sing","masc","trois"))); // Fido
    
  class parser P(G, s);
  P.print_grammar(cout);
  P.print_sentence(cout);
  P.parse_earley();
}
